package com.ymatou.query.trading.api.testcase;

import java.util.ArrayList;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.query.trading.api.parameter.GetBuyerOrderList3Bean;
import com.ymatou.query.trading.api.service.GetBuyerOrderList3Call;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P3;
import com.ymttest.utils.constant.ECode;

/**
 * 获取买家订单列表（只是用于码头app） FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_GetBuyerOrderList3 {

	private static GetBuyerOrderList3Bean getbuyerorderlistbean;
	private static GetBuyerOrderList3Call getbuyerorderlistcall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取买家订单列表（只是用于码头app）");
	}

	@Before
	public void caseUp() {

		getbuyerorderlistbean = new GetBuyerOrderList3Bean();
		getbuyerorderlistcall = new GetBuyerOrderList3Call();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getbuyerorderlistcall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetBuyerOrderList3_001() {
		Logger.start(true,"获取买家订单列表（只是用于码头app）成功");
		try {
			// 参数
			getbuyerorderlistbean.setBuyerId(1113);
			getbuyerorderlistbean.setLastOrderId(105249855);
			ArrayList<Integer> list = new ArrayList<Integer>();
			list.add(4);
			getbuyerorderlistbean.setOrderStatusList(list);
			getbuyerorderlistbean.setPageSize(5);
			// 发送请求
			getbuyerorderlistcall.setData(getbuyerorderlistbean);
			getbuyerorderlistcall.callService();
			Logger.comment("getbuyerorderlistcall send:" + getbuyerorderlistcall.getEntityString());
			Logger.comment("getbuyerorderlistcall response:" + getbuyerorderlistcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getbuyerorderlistcall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			// getbuyerorderlistcall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetBuyerOrderList3_002() {
		Logger.start(true,"买家用户id为空");
		try {
			// 参数
			// getbuyerorderlistbean.setBuyerId(1113);
			getbuyerorderlistbean.setLastOrderId(105249855);
			ArrayList<Integer> list = new ArrayList<Integer>();
			list.add(4);
			getbuyerorderlistbean.setOrderStatusList(list);
			getbuyerorderlistbean.setPageSize(5);
			// 发送请求
			getbuyerorderlistcall.setData(getbuyerorderlistbean);
			getbuyerorderlistcall.callService();
			Logger.comment("getbuyerorderlistcall send:" + getbuyerorderlistcall.getEntityString());
			Logger.comment("getbuyerorderlistcall response:" + getbuyerorderlistcall.getReturnData());
			Logger.verifyEquals(ECode.ERROR400, getbuyerorderlistcall.getCode(), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetBuyerOrderList3_003() {
		Logger.start(true,"最后一条订单号为空");
		try {
			// 参数
			getbuyerorderlistbean.setBuyerId(1113);
			// getbuyerorderlistbean.setLastOrderId(105249855);
			ArrayList<Integer> list = new ArrayList<Integer>();
			list.add(4);
			getbuyerorderlistbean.setOrderStatusList(list);
			getbuyerorderlistbean.setPageSize(5);
			// 发送请求
			getbuyerorderlistcall.setData(getbuyerorderlistbean);
			getbuyerorderlistcall.callService();
			Logger.comment("getbuyerorderlistcall send:" + getbuyerorderlistcall.getEntityString());
			Logger.comment("getbuyerorderlistcall response:" + getbuyerorderlistcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getbuyerorderlistcall.getCode(), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}